// --------------------------------------------------------------------------------------------------------------------

// <copyright file="StringFormatMethodAttribute.cs" company="Social Development Spb">

//   Copyright (c) Social Development Spb 2009

// </copyright>

// <summary>

//   Indicates that marked method builds string by format pattern and (optional) arguments.

//   Parameter, which contains format string, should be given in constructor.

//   The format string should be in <see cref="string.Format(IFormatProvider,string,object[])" /> -like form.

// </summary>

// --------------------------------------------------------------------------------------------------------------------


using System;

namespace Diagnostics.Annotations
{
    #region Imported Namespaces

    

    #endregion


    /// <summary>
    /// Indicates that marked method builds string by format pattern and (optional) arguments. 
    /// Parameter, which contains format string, should be given in constructor.
    /// The format string should be in <see cref="string.Format(IFormatProvider,string,object[])"/> -like form.
    /// </summary>
    [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
    public sealed class StringFormatMethodAttribute : Attribute
    {
        #region Constants and Fields

        private readonly string _formatParameterName;

        #endregion


        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="StringFormatMethodAttribute"/> class.
        /// </summary>
        /// <param name="formatParameterName">Specifies which parameter of an annotated method should be treated as format-string.</param>
        public StringFormatMethodAttribute(string formatParameterName)
        {
            _formatParameterName = formatParameterName;
        }

        #endregion


        #region Properties

        /// <summary>
        /// Gets format parameter name.
        /// </summary>
        /// <value>The name of the format parameter.</value>
        public string FormatParameterName
        {
            get
            {
                return _formatParameterName;
            }
        }

        #endregion
    }
}